#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main()
{
    int N;
    scanf("%d", &N);
    int i;
    char ch[N];
    float arr[N];
    float arr2[N];
    for (i = 0; i < N; i++)
    {
        fflush(stdin);
        scanf("\n%c%f", &ch[i], &arr[i]);
        if (ch[i] == 'F')
            arr2[i] = arr[i] * 1.09;
        else
            arr2[i] = arr[i] / 1.09;
    }
    for (i = 0; i < N; i++)
        printf("%.2f\n", arr2[i]);
    /*int arr[5][4] = { 0 };
    int m, n;
    for (m = 0; m < 4; m++)
        for (n = 0; n < 3; n++)
            scanf("%d", &arr[m][n]);
    for(m=0;m<4;m++)*/
    return 0;
}